Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an include_type_name option. #29453

Merged

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Apr 10, 2018

This adds an include_type_name option to the indices.create,
indices.get_mapping and indices.put_mapping APIs, which defaults to true.
When set to false, then mappings will be returned directly in the body of
the indices.get_mapping API, without keying them by the type name, the
indices.create will expect mappings directly under the mappings key, and
the indices.put_mapping will use _doc as a type name and fail if a type
is provided explicitly.

Relates #15613

This adds an `include_type_name` option to the `indices.create`,
`indices.get_mapping` and `indices.put_mapping` APIs, which defaults to `true`.
When set to `false`, then mappings will be returned directly in the body of
the `indices.get_mapping` API, without keying them by the type name, the
`indices.create` will expect mappings directly under the `mappings` key, and
the `indices.put_mapping` will use `_doc` as a type name and fail if a `type`
is provided explicitly.

Relates elastic#15613
@jpountz jpountz added >feature :Search/Search Search-related issues that do not fall into other categories v7.0.0 labels Apr 10, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@colings86
Copy link
Contributor

the indices.put_mapping will use _doc as a type name and fail if a type
is provided explicitly.

The documentation and the rest-spec API in this change do not seem to use _doc in the body or URL for the put mapping API. Is the description above wrong maybe?

@colings86
Copy link
Contributor

oh, actually I think I understand now. You mean that the API doesn't reference _doc in this case but the type that is used underneath will be _doc I wonder if this needs to be explained since the point of this option is to help the user prepare for an Elasticsearch which has types fully removed so maybe they don't need to know that we use _doc here as they should interact with the index without relying on the type anywhere?

@jpountz
Copy link
Contributor Author

jpountz commented Apr 11, 2018

You mean that the API doesn't reference _doc in this case but the type that is used underneath will be _doc

Correct. I will remove the reference to _doc in the put mapping docs.

@jpountz
Copy link
Contributor Author

jpountz commented Apr 11, 2018

@colings86 Does it look better?

Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that its clearer now. This PR LGTM

@jpountz jpountz merged commit 6a6c0ea into elastic:master Apr 11, 2018
@jpountz jpountz added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Search/Search Search-related issues that do not fall into other categories labels Apr 11, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jpountz jpountz deleted the enhancement/add_include_type_name_option branch April 11, 2018 14:42
@jpountz jpountz added :Core/Infra/REST API REST infrastructure and utilities and removed :Data Management/Indices APIs APIs to create and manage indices and templates labels Apr 13, 2018
jpountz added a commit to jpountz/elasticsearch that referenced this pull request Jan 4, 2019
This adds an `include_type_name` option to the `indices.create`,
`indices.get_mapping` and `indices.put_mapping` APIs, which defaults to `true`.
When set to `false`, then mappings will be returned directly in the body of
the `indices.get_mapping` API, without keying them by the type name, the
`indices.create` will expect mappings directly under the `mappings` key, and
the `indices.put_mapping` will use `_doc` as a type name and fail if a `type`
is provided explicitly.

On 5.x indices, get-mapping will fail if the index has multiple mappings, and
put-mapping will update or introduce mappings for the `_doc` type instead of
updating existing mappings. This oddity is required so that we don't have to
introduce a new flag to put-mapping requests to know whether they are actually
updating the `_doc` type or performing a typeless call.

Relates elastic#15613
jtibshirani pushed a commit that referenced this pull request Jan 9, 2019
This adds an `include_type_name` option to the `indices.create`,
`indices.get_mapping` and `indices.put_mapping` APIs, which defaults to `true`.
When set to `false`, then mappings will be returned directly in the body of
the `indices.get_mapping` API, without keying them by the type name, the
`indices.create` will expect mappings directly under the `mappings` key, and
the `indices.put_mapping` will use `_doc` as a type name and fail if a `type`
is provided explicitly.

On 5.x indices, get-mapping will fail if the index has multiple mappings, and
put-mapping will update or introduce mappings for the `_doc` type instead of
updating existing mappings. This oddity is required so that we don't have to
introduce a new flag to put-mapping requests to know whether they are actually
updating the `_doc` type or performing a typeless call.

Relates #15613
jtibshirani added a commit that referenced this pull request Jan 18, 2019
From #29453 and #37285, the `include_type_name` parameter was already present and defaulted to false. This PR makes the following updates:
- Add deprecation warnings to `RestPutMappingAction`, plus tests in `RestPutMappingActionTests`.
- Add a typeless 'put mappings' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I opted to create a new `PutMappingRequest` object that differs from the existing server one.
jtibshirani added a commit that referenced this pull request Jan 24, 2019
From #29453 and #37285, the include_type_name parameter was already present and defaulted to false. This PR makes the following updates:
* Add deprecation warnings to RestCreateIndexAction, plus tests in RestCreateIndexActionTests.
* Add a typeless 'create index' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I created new CreateIndexRequest and CreateIndexResponse objects that differ from the existing server ones.
jtibshirani added a commit that referenced this pull request Jan 24, 2019
From #29453 and #37285, the include_type_name parameter was already present and defaulted to false. This PR makes the following updates:
* Add deprecation warnings to RestCreateIndexAction, plus tests in RestCreateIndexActionTests.
* Add a typeless 'create index' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I created new CreateIndexRequest and CreateIndexResponse objects that differ from the existing server ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/REST API REST infrastructure and utilities >feature v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants